<page-header ng-if="ctrl.state.viewReady" title="'Application list'" breadcrumbs="['Applications']" reload="true"></page-header>

<kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading>

<div ng-if="ctrl.state.viewReady">
  <div class="row">
    <div class="col-sm-12" data-cy="k8sApp-appList">
      <rd-widget>
        <rd-widget-body classes="no-padding">
          <uib-tabset active="ctrl.state.activeTab" justified="true" type="pills" ng-if="!ctrl.deploymentOptions.hideStacksFunctionality">
            <uib-tab index="0" classes="btn-sm" select="ctrl.selectTab(0)">
              <uib-tab-heading class="vertical-center"> <pr-icon icon="'box'"></pr-icon> Applications </uib-tab-heading>

              <kubernetes-applications-datatable
                dataset="ctrl.state.applications"
                on-refresh="(ctrl.getApplications)"
                namespaces="ctrl.state.namespaces"
                namespace="ctrl.state.namespaceName"
                on-namespace-change="(ctrl.onChangeNamespaceDropdown)"
                is-loading="ctrl.state.isAppsLoading"
                show-system="ctrl.state.isSystemResources"
                on-show-system-change="(ctrl.setSystemResources)"
                on-remove="(ctrl.removeAction)"
                hide-stacks="ctrl.deploymentOptions.hideStacksFunctionality"
              >
              </kubernetes-applications-datatable>
            </uib-tab>
            <uib-tab index="2" classes="btn-sm" select="ctrl.selectTab(2)">
              <uib-tab-heading class="vertical-center"> <pr-icon icon="'list'"></pr-icon> Stacks </uib-tab-heading>

              <kubernetes-applications-stacks-datatable
                dataset="ctrl.state.stacks"
                on-refresh="(ctrl.getApplications)"
                on-remove="(ctrl.removeStacksAction)"
                namespaces="ctrl.state.namespaces"
                namespace="ctrl.state.namespaceName"
                is-loading="ctrl.state.isAppsLoading"
                on-namespace-change="(ctrl.onChangeNamespaceDropdown)"
                show-system="ctrl.state.isSystemResources"
                set-system-resources="(ctrl.setSystemResources)"
              >
              </kubernetes-applications-stacks-datatable>
            </uib-tab>
          </uib-tabset>
          <kubernetes-applications-datatable
            ng-if="ctrl.deploymentOptions.hideStacksFunctionality"
            dataset="ctrl.state.applications"
            on-refresh="(ctrl.getApplications)"
            namespaces="ctrl.state.namespaces"
            namespace="ctrl.state.namespaceName"
            on-namespace-change="(ctrl.onChangeNamespaceDropdown)"
            is-loading="ctrl.state.isAppsLoading"
            show-system="ctrl.state.isSystemResources"
            on-show-system-change="(ctrl.setSystemResources)"
            on-remove="(ctrl.removeAction)"
            hide-stacks="ctrl.deploymentOptions.hideStacksFunctionality"
          >
          </kubernetes-applications-datatable>
        </rd-widget-body>
      </rd-widget>
    </div>
  </div>
</div>
